package com.zc.study.java爬虫.netCase;

import com.sun.javafx.scene.control.skin.VirtualFlow.ArrayLinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Case2 {

    public static void main(String[] args) {
        String str = "<a>1<a><p>2<p><a>1<a><p>2<p><a>1<a><p>2<p><a>1<a><p>2<p><a>1<a><p>2<p><a>1<a><p>2<p>";
        String reg = "<a>(.*?)<a><p>(.*?)<p>";
        Matcher matcher = Pattern.compile(reg).matcher(str);
        List<String> list = new ArrayList<>();
        while (matcher.find()){
            System.out.println(matcher.group(2));
        }
    }
}
